import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import node from "@astrojs/node";
import { locales, defaultlocale, fallbacklocales } from './src/i18n/config';
import robotsTxt from "astro-robots-txt";

import tailwind from "@astrojs/tailwind";

// https://astro.build/config
export default defineConfig({
  site: 'http://localhost:4321',
  integrations: [
    mdx(), 
    sitemap(), 
    tailwind(),
    robotsTxt({
      policy: [{
        userAgent: '*',
        allow: '/',
        disallow: ['/login', '*/logout'],
        crawlDelay: 10,
      },
    ]})],
  i18n: {
    defaultLocale: defaultlocale,
    locales: Object.entries(locales).map(([lang, label]) => lang),
    routing: {
      prefixDefaultLocale: true
    },
    fallback: Object.assign({}, ...fallbacklocales.map((value, index) => ({
      [value]: defaultlocale
    })))
  },
  output: "server",
  adapter: node({
    mode: "standalone"
  })
});